<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <script type="text/javascript" src="{$resource_basic}/js/jquery.min.js"></script>
  

</head>

<body>

    
    <div id="barcodes">
        
    </div>
    
    <button id="chk_all" type="button">检查按钮</button>

<script>
$(function(){
    $("#chk_all").on("click",function(){
        $.ajax({ 
                   type: 'GET', 
                   url: '{:U("M/Scan/chk_all_products_by_id")}', 
                   dataType: 'json', 
                   data:"id=12467",
                   cache: false, 
                   error: function(){ 
                       return false; 
                   }, 
                   success:function(json){ 
                        if(json.id===0 || json.id==="0")
                        {
                            alert("计算结束");
                        }
                        else
                        {
                            chk_product(json.id);
                        }
                        
                   } 
               });
    });
});


function chk_product(id)
{
    $.ajax({ 
                   type: 'GET', 
                   url: '{:U("M/Scan/chk_all_products_by_id")}', 
                   dataType: 'json', 
                   data:"id="+id,
                   cache: false, 
                   error: function(){ 
                       return false; 
                   }, 
                   success:function(json){ 
                        if(json.id===0 || json.id==="0")
                        {
                            alert("计算结束");
                        }
                        else
                        {
                            chk_product(json.id);
                        }
                        
                   } 
               });
}
</script>
</body>
</html>